<template>
	<view class="userLayout pageBG" >
	<view class="user" v-if="userList">
		<!-- 上半部分 -->
		<view class="user-info" >
			<image src="/static/xxmLogo.png" mode="aspectFill"></image>
			<view class="name">{{userList.IP}}</view>
			<view class="adr">{{userList.address.city || userList.address.province}}</view>
		</view>
		<!-- 下半部分 -->
		<view class="user-item-group">
			<!-- 传递name和type的参数 -->
			<navigator url="/pages/classList/classList?name=我的下载&type=download">
			<view class="user-item" >
				<view class="left">
					<uni-icons type="download" size="20" color="#55ff7f"></uni-icons>
					<text class="test">我的下载</text>
				</view>
				<view class="right">
					<view class="">{{userList.downloadSize}}</view>
					<uni-icons type="right" size="20" color="#999"></uni-icons>
				</view>
			</view>
				</navigator>
				
				<navigator url="/pages/classList/classList?name=我的评分&type=score">
					<view class="user-item" >
						<view class="left">
							<uni-icons type="download" size="20" color="#55ff7f"></uni-icons>
							<text class="test">我的评分</text>
						</view>
						<view class="right">
							<view class="">{{userList.scoreSize}}</view>
							<uni-icons type="right" size="20" color="#999"></uni-icons>
						</view>
							
					</view>
				</navigator>
			<view class="user-item" >
				<view class="left">
					<uni-icons type="download" size="20" color="#55ff7f"></uni-icons>
					<text class="test">联系客服</text>
				</view>
				<!-- #ifdef APP -->
				<button open-type="contact">联系客服</button>
				<!-- #endif -->
				<!-- #ifndef APP -->
				<button click="clickContact">拨打电话</button>
				<!-- #endif -->
				
				
				<view class="right">
					<view class="">33</view>
					<uni-icons type="right" size="20" color="#999"></uni-icons>
				</view>
			</view>
		</view>
		<view class="user-item-group">
			<view class="user-item" >
				<view class="left">
					<uni-icons type="download" size="20" color="#55ff7f"></uni-icons>
					<text class="test">订阅更新</text>
				</view>
				<view class="right">
					<view class="">33</view>
					<uni-icons type="right" size="20" color="#999"></uni-icons>
				</view>
			</view>
			
			<view class="user-item" >
				<view class="left">
					<uni-icons type="download" size="20" color="#55ff7f"></uni-icons>
					<text class="test">常见问题</text>
				</view>
				<view class="right">
					<view class="">33</view>
					<uni-icons type="right" size="20" color="#999"></uni-icons>
				</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script setup>
	import {ref} from 'vue'
	const userList = ref(null)
const clickContact = ()=>{
	uni.makePhoneCall({
		phoneNumber: '114' //拨打的号码
	});
}
const getUserInfo =async()=>{
const res =await uni.request({
		url:"https://tea.qingnian8.com/api/bizhi/userInfo",
		header:{
			"access-key":"238762"
		}
	})

userList.value = res.data.data
}
getUserInfo()
</script>

<style lang="less" >
	.user {
			.user-info {
				text-align: center;
				margin: 50rpx auto;
	
				image {
					width: 400rpx;
					height: 400rpx;
					border-radius: 50%;
				}
			}
	
			.user-item-group {
				
				margin-bottom: 40rpx;
				background-color: #fff;
				border-radius: 10rpx;
				box-shadow: 0 0 30rpx rgba(0, 0, 0, 0.05);
			}
	
			.user-item {
				position: relative;
				height: 100rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				width: 690rpx;
				padding: 0 20rpx; /* 左右间隔 */
				margin:  auto;
				border: 1px solid #eee;
				border-radius: 10rpx;
				/* 分割线 */
	
				&:last-child {
					border-bottom: none;
				}
	
				.left {
					.test {
						margin-left: 10rpx;
						font-size: 30rpx;
					}
				}
	
				.right {
					display: flex;
					justify-content: center;
					align-items: center;
					color: #999999;
				}
				button{
					position: absolute;
					left: 0;
					top: 0;
					width: 100%;
					height: 100rpx;
					opacity: 0;
				}
			}
		}
</style>